package logic

import (
	"context"
	"srv/model/es"
	"srv/model/mysql"

	"srv/internal/svc"
	"srv/srv"

	"github.com/zeromicro/go-zero/core/logx"
)

type EsAddLogic struct {
	ctx    context.Context
	svcCtx *svc.ServiceContext
	logx.Logger
}

func NewEsAddLogic(ctx context.Context, svcCtx *svc.ServiceContext) *EsAddLogic {
	return &EsAddLogic{
		ctx:    ctx,
		svcCtx: svcCtx,
		Logger: logx.WithContext(ctx),
	}
}

func (l *EsAddLogic) EsAdd(in *srv.EsAddRequest) (*srv.EsAddResponse, error) {
	// todo: add your logic here and delete this line

	var good []mysql.Good
	mysql.DB.Find(&good)
	es.EsAdd(good)

	return &srv.EsAddResponse{}, nil
}
